<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Company extends Model
{
    public $timestamps = false;
    protected $connection = 'xz';
    protected $table = 'company';
    use HasFactory;

    public function recruits()
    {
        return $this->hasMany('App\Models\Recruit','resource_id','id')->select('id','title','recruit_type');
    }

    /**
     *  获取默认LOGO.
     *
     * @param string $value
     * @return string
     */
    public function getLogAttribute(string $value)
    {
        //如果没有logo
        if(!$value){
            return 'https://xinzhu-1301398555.cos.ap-shanghai.myqcloud.com/wxapp/company-logo.png';
        }
        return $value;
    }
}
